package com.java.blog.controller;

import java.util.Date;
import java.util.concurrent.Callable;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import com.java.blog.entity.Blog;
import com.java.blog.service.BlogService;

import io.swagger.annotations.Api;

@Api("后台控制层")
@RequestMapping("/admin")
@Controller
public class BackController {

	@Autowired
	private BlogService blogService;

	/**
	 * @Describe:跳转到首页
	 */
	@GetMapping("index")
	public String index() {
		return "index";
	}

	@GetMapping("test")
	public Callable<Blog> api() {
		return new Callable<Blog>() {
			@Override
			public Blog call() throws Exception {
				Thread.sleep(10L * 1000); // 暂停两秒
				Blog blog = new Blog(1, "ceshi", new Date(), "CONTENT");
				return blog;
			}
		};
	}

}
